home *** CD-ROM | disk | FTP | other *** search
/ Macromedia Multimedia Showcase 5.1 / Macromedia - Multimedia Showcase 5.1 (Macromedia) (1996).ISO / pc / media / shared.dir / 02001_Script_main movie script < prev    next >
Text File  |  1996-03-28  |  29KB  |  951 lines

  1. -- main movie script
  2.  
  3. on startTMOMovie
  4.   global forceStartFrame, cameFromScene, lastMouseEvent
  5.   -- check if jumping back from another movie
  6.   
  7.   if forceStartFrame > 0 and forceStartFrame < 200000 then
  8.     set newStartScene = forceStartFrame
  9.   else
  10.     set newStartScene = 0
  11.   end if
  12.   
  13.   set forceStartFrame = 0
  14.   set cameFromScene = 0
  15.   clearGlobals
  16.   sound stop 1
  17.   sound stop 2
  18.   set the exitLock = TRUE
  19.   CursorStatus(#initialize)  
  20.   global gAuthoring
  21.   set gAuthoring = TRUE -- AUT: set false when packaging the runtime projector
  22.   global gQuitPressed
  23.   set gQuitPressed = FALSE
  24.   InitGlossary() -- initiate glossary events
  25.   --
  26.   global gEventList
  27.   
  28.   SetupDatabases() -- store global pointers to items
  29.   BuildAnimationKeyFrameList()  
  30.   global gRecompileLists
  31.   
  32.   if the controlDown then -- shiftDown
  33.     set gRecompileLists = true
  34.   else
  35.     set gRecompileLists = false
  36.   end if
  37.   --òò
  38.   if gRecompileLists then
  39.     BuildEventList() -- load all events of this CD-ROM
  40.     SortEventList()  -- sort events in the list
  41.     BuildLocatorList()
  42.     -- AUT: sorting event list seems to inappropriately re-arrange
  43.     -- links that straddle over scenes (look at 4123 pre- and post- sort)
  44.     DumpListsToCast()
  45.   else
  46.     global gEventList, GlossaryList, gLocatorList
  47.     set gEventList = rebuildEventList()
  48.     -- set gEventList = value(the text of field "Compiled*Event*List")
  49.     set GlossaryList = value(the text of field "Compiled*Glossary*Items")
  50.     set gLocatorList = value(the text of field "Compiled*Locator*Items")
  51.   end if
  52.   
  53.   PrepGlossaryList()
  54.   --
  55.   global gNavObj
  56.   set gNavObj = birth(script "navigation object")
  57.   global gFileSuffix
  58.   
  59.   if gAuthoring then -- AUT: load authoring handlers    
  60.     set gFileSuffix = ".DIR"
  61.     -- InitAuthoringTools()
  62.   else
  63.     set gFileSuffix = ".DXR" -- change this to .EXE or .DXR eventually
  64.   end if
  65.   
  66.   if newStartScene > 0 then  -- coming back from demo movie...need to restore values
  67.     set oldDelim = the itemDelimiter
  68.     set the itemDelimiter = ";"
  69.     set startScene = newStartScene
  70.     set prefLine = line 1 of field "SavePrefsInfo"
  71.     set theVol = item 1 of prefLine
  72.     set theDelay = item 2 of prefLine
  73.     set thePlatform = item 3 of prefLine
  74.     set theMode = item 4 of prefLine
  75.     set theMusicOn = item 5 of prefLine
  76.     global gPresTimeList
  77.     set gPresTimeList = value(item 6 of prefLine)
  78.     InitPrefs(theVol,theDelay,thePlatform,theMode,theMusicOn) -- reset prefs to saved values
  79.     set the itemDelimiter = oldDelim
  80.   else
  81.     set startScene = 10000 -- AUT: the ID of the first scene
  82.     InitPrefs() -- initialize global preferences
  83.   end if
  84.   
  85.   checkMainMenuButton()
  86.   set lastMouseEvent = the ticks
  87.   
  88.   if the shiftDown then
  89.     addProp((the history of gNavObj), startScene, [0,0])  -- add goto point to history  
  90.     set startScene = 81000
  91.   end if
  92.   
  93.   JumpSequence(startScene)
  94.   --JumpSequence(95000) -- for debugging individual scenes
  95.   
  96.   CursorStatus(#reset)
  97.   
  98. end startTMOMovie
  99.  
  100. --
  101.  
  102. on JumpSequence myScene
  103.   -- put #JumpSequence && myScene && the movieName
  104.   global gNavObj
  105.   set the sceneID of gNavObj = string(myScene)
  106.   LoadSeq(gNavObj, myScene)
  107.   ChangeScene(gNavObj, myScene)
  108. end JumpSequence
  109.  
  110. --
  111.  
  112. on CursorStatus myStatus
  113.   if myStatus = #initialize then
  114.     global busyCast, busyCastMask, busyIndex, lastBusyTick
  115.     set busyCast = the number of cast "beachball 01"  
  116.     set busyCastMask = the number of cast "beachball mask"
  117.     set busyIndex = -1
  118.     set lastBusyTick = the ticks
  119.   else if myStatus = #reset then
  120.     cursor 0
  121.   end if
  122. end CursorStatus
  123.  
  124. --
  125.  
  126. on CursorBusy
  127.   global busyCast, busyCastMask, busyIndex, lastBusyTick
  128.   if the ticks - lastBusyTick > 3 then 
  129.     set lastBusyTick = the ticks
  130.     set busyIndex = (busyIndex+1) mod 4    
  131.     cursor [busyCast+busyIndex,busyCastMask]  
  132.     -- put #cursor && busyCast+busyIndex
  133.   end if
  134. end CursorBusy
  135.  
  136. --
  137. -- basic frame script: check events and rollovers every default exitFrame
  138.  
  139. on exitFrame
  140.   global gMode, lastMouseEvent
  141.   if gMode = #Demo then return
  142.   if (the ticks - lastMouseEvent) > (60*60*10) then
  143.     GoAttractLoop(#timeOut)
  144.   end if
  145.   global gNavObj
  146.   UpdateEvents(gNavObj) -- update event queue
  147.   UpdateRollover(gNavObj)
  148. end
  149.  
  150. --
  151.  
  152. on SetupDatabases
  153.   global sBirthPtr, tBirthPtr, sDeathPtr, tDeathPtr, castIdPtr, jumpToIdPtr, scriptPtr
  154.   set sBirthPtr = 1
  155.   set tBirthPtr = 2
  156.   set sDeathPtr = 3
  157.   set tDeathPtr = 4
  158.   set castIdPtr = 5
  159.   set jumpToIdPtr = 6
  160.   set scriptPtr = 6 
  161. end SetupDatabases
  162.  
  163. --
  164.  
  165. on BuildAnimationKeyFrameList
  166.   -- build list of animation key frames
  167.   global gAnimationScreenList
  168.   set gAnimationScreenList = [#6:73200,#9:73210,#12:73220,#16:73230,#17:73240,#19:73250,#24:73260,#25:73270,#31:73280,#35:73290,#36:73300,#39:73310,#45:73330,#51:73340,#53:73350,#56:73360,#59:73370,#61:73380,#63:73390,#64:73400,#66:73410,#67:73420,#70:73430,#71:73440,#75:73442,#76:73444,#78:73446,#85:73460,#75:73442,#76:73444,#78:73446,#89:73500,#92:73510,#93:73530,#94:73520,#109:73540,#111:73550]
  169.   sort gAnimationScreenList
  170.   global gAnimationReturnTime
  171.   set gAnimationReturnTime = 0
  172.   global gAnimReturnSet
  173.   set gAnimReturnSet = FALSE
  174. end BuildAnimationKeyFrameList
  175.  
  176. --
  177.  
  178. -- script for creating CD-ROM event list
  179. -- event list is a "list of lists":
  180. -- it stores each sceneID that has special events in it (links to be born, etc)
  181. -- and the necessary info to deal with those links, as stored in cast "dbase*events"
  182. -- to see what it looks like, put gEventList
  183.  
  184. on BuildEventList  
  185.   global gEventList, sBirthPtr, jumpToIdPtr
  186.   set gEventList = [:]  
  187.   -- build list of scene events   
  188.   set myScenes = the text of cast "dbase*navigation"
  189.   set sceneCount = the number of lines of myScenes
  190.   -- create a list of all scene IDs in the navigation dbase
  191.   repeat with i = 1 to sceneCount
  192.     CursorBusy()
  193.     set myLine = line i of myScenes
  194.     addProp gEventList, value("#" & item sBirthPtr of myLine), [ ]
  195.   end repeat
  196.   -- add list of events to each scene ID
  197.   global castIdPtr
  198.   set linkstext = the text of cast "dbase*events"
  199.   set eventCount = the number of lines of linkstext
  200.   repeat with i = 1 to eventCount
  201.     CursorBusy()
  202.     set myLine = item 1 to 6 of line i of linkstext -- 11/15 NH hack: no label in compiled list
  203.     
  204.     set eventType = item castIdPtr of myLine
  205.     if eventType contains "L" then
  206.       -- put myLine
  207.       FillEvents(myLine) -- link: straddle over scenes until link death
  208.       set myID = item jumpToIdPtr of myLine
  209.       if myID contains "glossary" then
  210.         AddGlossaryItem(myID)
  211.       end if
  212.     else if eventType contains "B" then
  213.       -- put myLine
  214.       StraddleBtn(myLine)
  215.     else
  216.       -- put item sBirthPtr of myLine -- NOTE 11/2: comment out this line after debugged
  217.       -- this puts a trail in the message window.  
  218.       -- The last item is the item that has a problem.
  219.       -- traceME
  220.       getAProp gEventList, value("#" & item sBirthPtr of myLine)
  221.       set ptrList = the result
  222.       if not listP(ptrList) then put myLine
  223.       add ptrList, myLine
  224.     end if
  225.   end repeat
  226.   
  227. end BuildEventList
  228.  
  229. --
  230.  
  231. on StraddleBtn whichEvent 
  232.   global castIdPtr, sBirthPtr, sDeathPtr, tBirthPtr, tDeathPtr, gEventList
  233.   -- event is a button: see if we need to straddle it accross multiple scenes
  234.   findPos gEventList, value("#" & item sBirthPtr of whichEvent)
  235.   set birthPtr = the result
  236.   set myDeath = item sDeathPtr of whichEvent
  237.   findPos gEventList, value("#" & myDeath)
  238.   set deathPtr = the result
  239.   --  put whichEvent
  240.   --  put birthPtr & "-" & deathPtr  
  241.   set myEvent = whichEvent
  242.   repeat with i = birthPtr to deathPtr
  243.     getPropAt gEventList, i
  244.     set mySceneID = string(the result)
  245.     put mySceneID into item sBirthPtr of myEvent    
  246.     put mySceneID into item sDeathPtr of myEvent    
  247.     getAt gEventList, i   
  248.     set ptrList = the result
  249.     add ptrList, myEvent    
  250.   end repeat
  251. end StraddleBtn
  252.  
  253. --
  254.  
  255. on FillEvents whichEvent
  256.   global castIdPtr, sBirthPtr, sDeathPtr, tBirthPtr, tDeathPtr, gEventList
  257.   -- event is a link: add death time and future occurrences to event que
  258.   findPos gEventList, value("#" & item sBirthPtr of whichEvent)
  259.   set birthPtr = the result
  260.   set myDeath = item sDeathPtr of whichEvent
  261.   findPos gEventList, value("#" & myDeath)
  262.   set deathPtr = the result
  263.   -- put whichEvent && birthPtr & "-" & deathPtr
  264.   set myEvent = whichEvent
  265.   set deathTime = item tDeathPtr of myEvent
  266.   put "-" into item tDeathPtr of myEvent
  267.   repeat with i = birthPtr to deathPtr
  268.     if i = birthPtr+1 then
  269.       put "00000" into item tBirthPtr of myEvent
  270.     end if
  271.     getPropAt gEventList, i
  272.     set mySceneID = string(the result)
  273.     put mySceneID into item sBirthPtr of myEvent
  274.     getAt gEventList, i   
  275.     set ptrList = the result
  276.     add ptrList, myEvent    
  277.   end repeat
  278.   -- now add kill event at index deathPtr...  
  279.   put deathTime into item tDeathPtr of myEvent
  280.   put "K" into char 1 of item castIdPtr of myEvent
  281.   put item tDeathPtr of whichEvent into item tBirthPtr of myEvent  
  282.   add ptrList, myEvent
  283. end FillEvents
  284.  
  285. --
  286.  
  287. on SortEventList
  288.   -- places the events within each scene in chronological order  
  289.   global gEventList
  290.   set lastItem = count(gEventList)
  291.   repeat with i = 1 to lastItem
  292.     getAt gEventList, i
  293.     set myList = the result
  294.     sort myList
  295.     setAt gEventList, i, myList
  296.   end repeat
  297. end SortEventList
  298.  
  299. --
  300.  
  301. on BuildLocatorList
  302.   global gLocatorList
  303.   set gLocatorList = [ : ]
  304.   set myLocators = the text of cast "dbase*locators"
  305.   set numLocators = the number of lines of myLocators
  306.   repeat with thisLocNum = 1 to numLocators
  307.     set whatToDoList = [ : ]
  308.     set thisLoc = line thisLocNum of myLocators
  309.     set thisLocID = item 1 of thisLoc
  310.     repeat with resultLoc = 2 to (the number of items of thisLoc)
  311.       addProp (whatToDoList,item resultLoc of thisLoc, (resultLoc - 1))
  312.     end repeat
  313.     addProp(gLocatorList, thisLocID, whatToDoList)
  314.   end repeat
  315.   sortLocatorList
  316.   return 1
  317. end BuildLocatorList
  318.  
  319. --
  320.  
  321. on SortLocatorList
  322.   global gLocatorList
  323.   sort gLocatorList
  324.   repeat with i in gLocatorList
  325.     sort i
  326.   end repeat
  327. end sortLocatorList
  328.  
  329. --
  330.  
  331. on DumpListsToCast
  332.   global gEventList, GlossaryList, gLocatorList
  333.   sort GlossaryList
  334.   repeat with i = 1 to 10
  335.     set currentEventField = "Compiled*Event*List*" & i
  336.     set maxNum = count(gEventList)
  337.     set thisList = [ : ]
  338.     repeat with j = ((70 * (i-1)) + 1) to (i * 70)
  339.       cursorBusy()
  340.       if j > maxNum then exit repeat
  341.       set thisProp = getPropAt(gEventList, j)
  342.       set thisVal = getAt(gEventList, j)
  343.       addProp(thisList, thisProp, thisVal)
  344.     end repeat
  345.     put "dumping to cast: " & currentEventField
  346.     put thisList into field currentEventField
  347.   end repeat
  348.   -- put gEventList into field "Compiled*Event*List"
  349.   put GlossaryList into field "Compiled*Glossary*Items"
  350.   put gLocatorList into field "Compiled*Locator*Items"
  351. end DumpListsToCast
  352.  
  353. on rebuildEventList
  354.   set newEventList = [ : ]
  355.   repeat with i = 1 to 10
  356.     set currentEventField = "Compiled*Event*List*" & i
  357.     set tempList = value(field currentEventField)
  358.     set howManyThisTime = count(tempList)
  359.     if howManyThisTime > 0 then
  360.       repeat with j = 1 to howManyThisTime
  361.         set thisProp = getPropAt(tempList, j)
  362.         set thisVal = getAt(tempList, j)
  363.         addProp(newEventList, thisProp, thisVal)
  364.       end repeat
  365.     end if
  366.   end repeat
  367.   return newEventList
  368. end rebuildEventList
  369.  
  370. --
  371.  
  372. on InitPrefs forceVolume, forceDelay, forcePlatform, forceMode, forceMusic
  373.   global gSoundLevel, K, gAuthoring, gPlatform, gMode, gPresZone
  374.   if voidP(forceVolume) then
  375.     -- if gAuthoring then
  376.     if the machineType = 256 then
  377.       SetVolume(2,#InitPrefs)
  378.     else
  379.       SetVolume(3,#InitPrefs)
  380.     end if
  381.   else
  382.     setVolume(forceVolume,#InitPrefs)  
  383.   end if
  384.   if (the machineType = 256) or (forcePlatform contains "PC") then set gPlatform = #PC
  385.   else set gPlatform = #Mac
  386.   if (forceDelay >= 1) and (forceDelay <= 9999) then
  387.     SetAnimDelay(forceDelay,#InitPrefs)
  388.   else
  389.     SetAnimDelay(2,#InitPrefs) -- set default delay to medium
  390.   end if
  391.   if forceMode contains "Presentation" then
  392.     set gMode = #Presentation
  393.     set gPresZone = #Green
  394.   else
  395.     set gMode = #Normal
  396.   end if
  397.   if not voidP(forceMusic) then
  398.     if forceMusic <> "0" then setMusicPlaying(#ON,#InitPrefs)
  399.     else setMusicPlaying(#OFF,#InitPrefs)
  400.   else
  401.     SetMusicPlaying(#ON,#InitPrefs)  -- aut: set music off (JS 11/15)--back on 12/7(IB)
  402.   end if
  403.   set the timeOutLength = 60*60*10  -- 10 minutes
  404.   set the timeOutScript = "GoAttractLoop(#timeOut)"
  405. end InitPrefs
  406. --
  407.  
  408. on SetIndicatorPuppets
  409.   -- put #SetIndicatorPuppets
  410.   global gModeIndSprite, gDelayIndSprite, gMusicIndSprite
  411.   -- AUT: the sprite #s of the preference btn level indicators
  412.   set gModeIndSprite = 22
  413.   set gDelayIndSprite = 47
  414.   set gMusicIndSprite = 48
  415.   puppetSprite gModeIndSprite, TRUE
  416.   puppetSprite gDelayIndSprite, TRUE
  417.   puppetSprite gMusicIndSprite, TRUE
  418.   global gNavObj
  419.   Add (the exitQue of gNavObj, "KillIndicatorPuppets")
  420.   -- global gSoundLevel
  421.   -- SetSoundIndicator(gSoundLevel)
  422.   global gMode
  423.   setModeIndicator(gMode)
  424.   global K
  425.   SetDelayIndicator(K)
  426.   global gMusicOn
  427.   SetMusicIndicator(gMusicOn)
  428. end SetIndicatorPuppets
  429.  
  430. --
  431.  
  432. on KillIndicatorPuppets
  433.   global gModeIndSprite, gDelayIndSprite, gMusicIndSprite
  434.   puppetSprite gModeIndSprite, FALSE
  435.   puppetSprite gDelayIndSprite, FALSE
  436.   puppetSprite gMusicIndSprite, FALSE
  437.   -- put #KillIndicatorPuppets
  438. end KillIndicatorPuppets
  439.  
  440. -- 
  441.  
  442. on SetVolume myLevel, theCaller
  443.   global gSoundLevel -- range of 0 .. 7
  444.   set gSoundLevel = value(myLevel)
  445.   set the soundLevel = gSoundLevel
  446.   global gNavObj
  447.   set theVolumeSprite = the volumeSprite of gNavObj
  448.   puppetsprite theVolumeSprite,TRUE
  449.   set volPictNum = myLevel
  450.   if volPictNum > 6 then set volumePictNum = 6
  451.   set the castNum of sprite theVolumeSprite = the number of cast ("volume" & volPictNum)
  452.   updateStage
  453.   if not(theCaller = #InitPrefs) then
  454.     SetSoundIndicator(myLevel)
  455.     if the machineType = 256 then
  456.       set QTCast = the castNum of sprite (the QTMSprite of gNavObj)
  457.       if QTCast > 0 then exit
  458.     end if
  459.     if myLevel >= 6 then
  460.       sound playFile 2, "81000a.aif"
  461.     else if myLevel >= 2 then
  462.       sound playFile 2, "81000b.aif"
  463.     else if myLevel >= 1 then
  464.       sound playFile 2, "81000c.aif"
  465.     else -- myLevel = 0
  466.       beep
  467.     end if
  468.   end if
  469. end SetVolume
  470. --
  471.  
  472. on SetAnimDelay theValue, theCaller
  473.   global K -- timeout delay constant; range of 1,2,3 to 9999
  474.   set K = theValue
  475.   SetDelayIndicator(K)
  476. end SetAnimDelay
  477.  
  478. --
  479.  
  480. on SetMusicPlaying theValue, theCaller
  481.   global gMusicOn, gNavObj
  482.   if theValue = #ON or theValue contains "ON" then
  483.     set gMusicOn = TRUE
  484.     global gNavObj
  485.     if not(theCaller = #InitPrefs) then
  486.       PlaySceneMusic(gNavObj)
  487.     end if
  488.   else if theValue = #OFF or theValue contains "OFF" then    
  489.     set gMusicOn = FALSE
  490.     set the musicPlaying of gNavObj = FALSE
  491.     puppetsound 0
  492.   end if
  493.   SetMusicIndicator(gMusicOn)
  494. end SetMusicPlaying
  495.  
  496. --
  497.  
  498. on SetMusicIndicator myLevel
  499.   global gMusicOn, gMusicIndSprite
  500.   if gMusicOn then
  501.     set the loc of sprite gMusicIndSprite = point(243, 170) -- 18,254)
  502.   else
  503.     set the loc of sprite gMusicIndSprite = point(243, 210) -- 58,284)
  504.   end if
  505. end SetMusicIndicator
  506.  
  507. --
  508.  
  509. on SetSoundIndicator myLevel
  510.   
  511.   return -1 --òò
  512.   -- global gSoundIndSprite
  513.   set defaultX = 18
  514.   set defaultY = 74
  515.   set IndDeltaX = 40
  516.   set IndDeltaY = 30
  517.   set volumeList = [0:3,1:2,3:1,6:0]
  518.   sort volumeList
  519.   findPos volumeList, myLevel
  520.   getAt volumeList, the result
  521.   set myOffset = the result
  522.   -- set the locH of sprite gSoundIndSprite = defaultX + myOffset*IndDeltaX
  523.   -- set the locV of sprite gSoundIndSprite = defaultY + myOffset*IndDeltaY  
  524. end SetSoundIndicator
  525.  
  526. --
  527.  
  528. on setModeIndicator
  529.   global gMode, gModeIndSprite
  530.   if gMode = #Presentation then
  531.     set the loc of sprite gModeIndSprite = point(75, 210)
  532.   else
  533.     set the loc of sprite gModeIndSprite = point(75, 170)
  534.   end if
  535. end setModeIndicator
  536.  
  537. --
  538.  
  539. on SetDelayIndicator myLevel
  540.   -- put #animDelay && myLevel
  541.   global gDelayIndSprite
  542.   set defaultX = 412 -- 342
  543.   set defaultY = 170 -- 254
  544.   set IndDeltaX = 0 -- 38
  545.   set IndDeltaY = 40 -- 30
  546.   set myList = [1:3,2:2,3:1,9999:0]
  547.   sort myList
  548.   findPos myList, myLevel
  549.   getAt myList, the result
  550.   set myOffset = the result
  551.   set the locH of sprite gDelayIndSprite = defaultX + myOffset*IndDeltaX
  552.   set the locV of sprite gDelayIndSprite = defaultY + myOffset*IndDeltaY  
  553. end SetDelayIndicator
  554.  
  555. --
  556.  
  557. on Say whatFile
  558.   if soundBusy(2) then
  559.     sound close 2
  560.     updateStage
  561.   end if
  562.   set soundFileName = string(whatFile & ".AIF")
  563.   sound playFile 2, soundFileName
  564.   ResetNavTimeout()
  565.   put #ResetNavTimeOut
  566. end Say
  567.  
  568. --
  569.  
  570. on AddVOExitScript
  571.   -- put #AddVOExitScript
  572.   global gNavObj
  573.   Add (the exitQue of gNavObj), "CloseSoundChannel 2"
  574. end AddVOExitScript
  575.  
  576. --
  577.  
  578. on CloseSoundChannel whichChannel
  579.   if soundBusy(whichChannel) then
  580.     put #CloseSoundChannel && whichChannel
  581.     sound close whichChannel  
  582.     -- updateStage
  583.   end if  
  584. end CloseSoundChannel
  585.  
  586. --
  587.  
  588. on StoreParent jumpToID
  589.   global gNavObj
  590.   put the sceneID of gNavObj
  591.   set the returnSceneID of gNavObj = the sceneID of gNavObj
  592.   put jumpToID  
  593.   LoadSeq(gNavObj, jumpToID)
  594.   ChangeScene(gNavObj, jumpToID) 
  595. end StoreParent
  596.  
  597. --
  598.  
  599. on JumpToSlide  
  600.   global gNavObj, gAnimationScreenList
  601.   set myTime = the movieTime of sprite the QTMSprite of gNavObj
  602.   set the movieRate of sprite (the QTMSprite of gNavObj) = 0
  603.   set myTime = integer(myTime/60)
  604.   --
  605.   findPosNear gAnimationScreenList, myTime
  606.   set myPos = the result
  607.   set myLast = count(gAnimationScreenList)  
  608.   if myPos > myLast then
  609.     set myPos = myLast
  610.   end if
  611.   getAt gAnimationScreenList, myPos
  612.   set myScene = the result
  613.   JumpSequence(myScene)
  614. end JumpToSlide
  615.  
  616. --
  617.  
  618. on JumpToAnim
  619.   global gAnimationScreenList
  620.   global gNavObj
  621.   set myScene = value(the sceneID of gNavObj)
  622.   global gAnimationReturnTime
  623.   GetOne(gAnimationScreenList, myScene)
  624.   set gAnimationReturnTime = the result
  625.   global gAnimReturnSet
  626.   set gAnimReturnSet = TRUE
  627.   set myScene = "73000" -- AUT: hardwired return scene for the animation
  628.   JumpSequence(myScene)
  629. end JumpToAnim
  630.  
  631. --
  632.  
  633. on HandleKeyPress
  634.   set keyPressed = the keyCode 
  635.   -- AUT: disable thise one for golden master:
  636.   -- CheckSpaceBarPressed(keyPressed)
  637.   --
  638.   -- trap exit shortcut
  639.   set period = 47
  640.   set Q = 12
  641.   if ((the keyCode = period OR the keyCode = Q) AND the commandDown) then
  642.     global gQuitPressed
  643.     -- if gQuitPressed then
  644.     Quit -- second time you are pressing quit, so exit immediately
  645.     --    else      
  646.     --      set myScene = 90000 -- AUT: hardwired sceneID of the exit scene
  647.     --      JumpSequence(myScene)
  648.     --      set gQuitPressed = TRUE
  649.     --    end if
  650.   end if
  651. end HandleKeyPress
  652.  
  653. --
  654.  
  655. on CheckSpaceBarPressed keyPressed
  656.   set spaceBar = 49  
  657.   if keyPressed = spaceBar then
  658.     global gNavObj
  659.     set myScene = the sceneID of gNavObj
  660.     alert "Current sequence ID:" && myScene
  661.   end if
  662. end CheckSpaceBarPressed
  663.  
  664. --
  665.  
  666. on PreloadScene whichScene
  667.   global gNavObj
  668.   if whichScene = #current then
  669.     -- put #preloadcurrent && the sceneID of gNavObj
  670.     set curScene = the sceneID of gNavObj
  671.     set startFrame = string(curScene)
  672.     set endFrame = string(curScene & "end")
  673.   else if whichScene = #next then
  674.     -- load the next scene into memory
  675.     set nextScene = the nextlink of gNavObj
  676.     if integerP(nextScene) and (nextScene > 0) then
  677.       -- this is to account for the possibility of nextScene
  678.       --  being a handler instead of an integer scene number
  679.       set startFrame = 0
  680.     else
  681.       set startFrame = string(nextScene)
  682.       set endFrame = string(nextScene & "end")
  683.     end if
  684.   else
  685.     set startFrame = string(whichScene)
  686.     set endFrame = string(whichScene & "end")
  687.   end if
  688.   if startFrame > 0 then
  689.     set memNeeded = ramNeeded(startFrame, endFrame)
  690.     if memNeeded >= the freebytes then
  691.       -- not enough memory to load scene, dump other stuff first
  692.       unloadStartToCurrent(memNeeded)
  693.     end if
  694.     preload startFrame, endFrame
  695.   end if
  696.   -- put #preload & whichScene && startFrame & "-" & endFrame & "; loaded:" && the result
  697. end PreloadScene
  698.  
  699. --
  700.  
  701. on UnloadStartToCurrent memNeeded
  702.   if voidP(memNeeded) or memNeeded = 0 then set memNeeded = (2048*1024)  -- 2 Megs
  703.   set preMemory = string(the freeBytes/1024 & "KB")
  704.   set startFrame = 1
  705.   set endFrame = the frame-1
  706.   if the freebytes < memNeeded then
  707.     -- don't unload if 2 Megs or more still available
  708.     unLoad startFrame, endFrame
  709.   end if
  710.   set myResult = the result
  711.   set postMemory = string(the freeBytes/1024 & "KB")
  712.   -- put #unloadRange && startFrame & "-" & endFrame && "pre:" && preMemory && "post:" && postMemory  
  713. end UnloadStartToCurrent
  714.  
  715. --
  716.  
  717. on SetModePref theMode
  718.   -- theMode could be #Normal or #Presentation
  719.   global gMode
  720.   if theMode = #Presentation or theMode = "#Presentation" then
  721.     set the text of cast "Presentation Setup" = "Your Message Here"
  722.     jumpSequence(81400)
  723.   else
  724.     set gMode = theMode
  725.     checkMainMenuButton
  726.     setIndicatorPuppets
  727.   end if
  728. end SetModePref
  729.  
  730. --
  731. on initPres
  732.   global gMode, gPresZone, gPresTimeList
  733.   set presentTime = value(field "Presentation Time")
  734.   if presentTime > 0 and presentTime < 999 then
  735.     set gPresZone = #Waiting
  736.     set curTime = 0
  737.     set endTime = (presentTime * 60 * 60)
  738.     set warnTime = integer((endTime - curTime) * .8)  -- after 80% of time expires
  739.     set gPresTimeList = [curTime, warnTime, endTime]
  740.     set gMode = #Presentation
  741.     jumpSequence(10000)
  742.   else
  743.     alert "You must enter a value for the Presentation Timer."
  744.   end if  
  745. end initPres
  746.  
  747. on StartPres
  748.   global gMode, gPresZone, gPresTimeList
  749.   if gMode = #Presentation then
  750.     set gPresZone = #Green
  751.     set newTicks = the ticks
  752.     set curTime = getAt(gPresTimeList, 1) + newTicks
  753.     set warnTime = getAt(gPresTimeList,2) + newTicks
  754.     set endTime = getAt(gPresTimeList,3) + newTicks
  755.     set gPresTimeList = [curTime, warnTime, endTime]
  756.     setNewPict("loc15000", "MenuGreen", #MenuSprite)
  757.   end if
  758. end startPres
  759.  
  760. --
  761.  
  762. on GoAttractLoop caller
  763.   global gMode, gNavObj
  764.   if caller = #timeOut and gMode = #Presentation then
  765.     return 0
  766.   end if
  767.   set theScene = the sceneID of gNavObj
  768.   if value(theScene) <> 10000 then jumpSequence(10000)
  769. end GoAttractLoop
  770. --
  771. on checkMainMenuButton
  772.   global gMode, gPresZone, gPresTimeList
  773.   if gPresZone = #Waiting then return 0
  774.   set MainMenuCast = the number of cast "loc15000"
  775.   set recopy = not(the loaded of cast MainMenuCast)
  776.   if recopy then
  777.     copyToClipboard cast "MenuNormal"
  778.     pasteClipBoardInto cast MainMenuCast
  779.     -- duplicate cast (the number of cast "MenuNormal"),MainMenuCast
  780.     set the name of cast MainMenuCast = "loc15000"
  781.     -- set the scriptText of cast MainMenuCast = the scriptText of cast "MenuNormal"
  782.     set gPresZone = #Nothing
  783.   end if
  784.   if gMode = #Presentation then
  785.     set yellowTime = getAt(gPresTimeList, 2)
  786.     set redTime = getAt(gPresTimeList, 3)
  787.     set curTime = the ticks
  788.     if (curTime >= yellowTime) and (curTime < redTime) then
  789.       if gPresZone <> #Yellow then
  790.         set gPresZone = #Yellow
  791.         --!!
  792.         -- duplicate cast (the number of cast "MenuYellow"), MainMenuCast
  793.         -- set the name of cast MainMenuCast = "loc15000"
  794.         --!!
  795.         setNewPict("loc15000", "MenuYellow",#MenuSprite)
  796.       end if
  797.     else
  798.       if curTime >= redTime then
  799.         if gPresZone <> #Red then
  800.           set gPresZone = #Red
  801.           --!!
  802.           -- duplicate cast (the number of cast "MenuRed"), MainMenuCast
  803.           -- set the name of cast MainMenuCast = "loc15000"
  804.           --!!
  805.           setNewPict("loc15000", "MenuRed",#MenuSprite)
  806.         end if
  807.       else
  808.         -- still in green zone
  809.         if gPresZone <> #Green then
  810.           set gPresZone = #Green
  811.           --!!
  812.           -- duplicate cast (the number of cast "MenuRed"), MainMenuCast
  813.           -- set the name of cast MainMenuCast = "loc15000"
  814.           --!!
  815.           setNewPict("loc15000", "MenuGreen",#MenuSprite)
  816.         end if
  817.       end if
  818.     end if
  819.   else
  820.     -- not in a presentation
  821.     --!!
  822.     -- duplicate cast (the number of cast "MenuNormal"), MainMenuCast
  823.     -- set the name of cast MainMenuCast = "loc15000"
  824.     --!!
  825.     setNewPict("loc15000", "MenuNormal",#MenuSprite)
  826.   end if
  827. end setMainMenuButton
  828.  
  829. --
  830.  
  831. on setNewPict origCast, newPictCast, whichSprite
  832.   if integerP(whichSprite) then set theSprite = whichSprite
  833.   else
  834.     if whichSprite = #MenuSprite then
  835.       set theSprite = 27
  836.     end if
  837.   end if
  838.   if false then -- the movieName contains ".DIR" then
  839.     puppetsprite theSprite, TRUE
  840.     set the castNum of sprite theSprite = the number of cast newPictCast
  841.   else
  842.     --    set origName = the name of cast origCast
  843.     --    set origNum = the number of cast origCast
  844.     --    copyToClipBoard cast newPictCast
  845.     --    pasteClipBoardInto cast origCast
  846.     --    set the name of cast origNum = origName
  847.     set the picture of cast origCast to the picture of cast newPictCast
  848.   end if
  849. end setNewPict
  850.  
  851. --
  852.  
  853. on runDemo theDemoMovie
  854.   global K, gPlatform, gMode, gMusicOn, gNavObj, gPresZone, gPresTimeList
  855.   set c = ";"
  856.   if gMode <> #Presentation then
  857.     set gPresTimeList = [0,0,0]
  858.   end if
  859.   set prefsLine = string(the soundLevel) & c & K & c & gPlatform & c & gMode & c & gMusicOn & c & gPresTimeList
  860.   put prefsLine into line 1 of field "SavePrefsInfo"
  861.   set tempScene = the sceneID of gNavObj
  862.   global cameFromScene, forceStartFrame
  863.   set cameFromScene = tempScene
  864.   set gMode = #Demo
  865.   set forceStartFrame = theDemoMovie
  866.   set firstNav = the firstNavSprite of gNavObj
  867.   set lastNav = (the firstLocatorSprite of gNavObj) + 2
  868.   set firstLink = the firstLinkSprite of gNavObj
  869.   set lastLink = the lastLinkSprite of gNavObj
  870.   repeat with i = firstNav to lastNav
  871.     puppetsprite i,FALSE
  872.   end repeat
  873.   repeat with i = firstLink to lastLink
  874.     puppetsprite i,FALSE
  875.   end repeat
  876.   puppetsprite (the btnOutlineSprite of gNavObj),FALSE
  877.   go to frame "DemoExit"
  878.   -- go to movie theDemoMovie
  879. end AddScrollingText
  880.  
  881. --
  882.  
  883. on toggleQT spriteNum, onOrOff
  884.   if the castNum of sprite spriteNum > 0 then
  885.     set the movieRate of sprite spriteNum = onOrOff
  886.   end if
  887. end toggleQT
  888.  
  889. --
  890.  
  891. on waitForMouseUp theClickOn
  892.   global gNavObj, lastMouseEvent
  893.   set rollingOver = TRUE
  894.   BtnOutlineStart(gNavObj)
  895.   updateStage
  896.   set lastMouseEvent = the ticks
  897.   repeat while the mouseDown
  898.     if rollover(theClickOn) then
  899.       if not rollingOver then
  900.         hilite(gNavObj, theClickOn)
  901.         updateStage
  902.         set rollingOver = true
  903.       end if
  904.     else
  905.       if rollingOver then
  906.         set rollingOver = false
  907.         unhilite(gNavObj)
  908.         updateStage
  909.       end if
  910.     end if
  911.   end repeat
  912.   set the foreColor of sprite (the btnOutlineSprite of gNavObj) = 0
  913.   set lastMouseEvent = the ticks
  914.   if rollover(theClickOn) then
  915.     hilite(gNavObj, theClickOn)
  916.     updateStage
  917.     return 1
  918.   else
  919.     unhilite(gNavObj)
  920.     updateStage
  921.     return 0
  922.   end if
  923. end waitForMouseUp
  924.  
  925. --
  926.  
  927. on getEndLocators sceneNum
  928.   global gNavObj
  929.   set endLocList = [ 81000:"loc81000", 81400:"loc81000", 82000:"loc82000", 89000:"loc90000", 90000:"loc90000", 92000:"loc92000" ] --, 95000:"loc95000", 80000:"loc80000",]
  930.   set closeLoc = 0
  931.   repeat with i = 1 to count(endLocList)
  932.     set nextOne = getPropAt(endLocList,i)
  933.     if (nextOne > closeLoc) and (nextOne <= sceneNum) then
  934.       set closeLoc = i
  935.     end if
  936.   end repeat
  937.   set MainMenuLoc = the MainMenuLoc of gNavObj
  938.   set tempLocators = [ MainMenuLoc, getAt(endLocList,closeLoc) ]
  939.   return tempLocators
  940. end getEndLocators
  941.  
  942. --
  943.  
  944. on inVision sceneNum
  945.   -- check if scene is in vision section OR Educaton (ljd 3-18-96 SC 5.1)
  946.   if (sceneNum >= 29000 and sceneNum < 30000) or sceneNum >= 95000 then
  947.     return TRUE
  948.   else
  949.     return FALSE
  950.   end if
  951. end inVision